<template>
	<view class="blog-item mt20 bg-white" @tap="handleBlogDetail">
		<view class="item-content">
			<view class="item-title line1 md title-color">{{ blog.title }}</view>
			<view class="item-meta row mt10">
				<view class="meta-user-time meta-color sm">{{ calTime(blog.date.iso) }}</view>
			</view>
		</view>
	</view>
</template>

<script>
import { timeago, dateChangeFormat } from '@/utils/tools.js';

export default {
	name: 'solidot-item',
	props: {
		blog: {
			type: Object,
			default: {}
		}
	},
	data() {
		return {};
	},
	methods: {
		calTime(time) {
			return timeago(new Date(time).getTime());
		},
		handleBlogDetail() {
			window.open(this.blog.url);
		}
	}
};
</script>

<style scoped lang="less">
.blog-item {
	.item-content {
		padding: 20rpx;
		.title-color {
			color: #1d2129;
		}
		.meta-color {
			color: #86909c;
		}
		.li-tag {
			max-width: 100rpx;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
	}
}
</style>
